<template>
  <div
    class="leftClass"
    style="height: 100%"
    :style="{ '--theme': $store.getters.themeColor }"
  >
    <el-row style="height: 100%">
      <el-col style="height: 100%" :span="24" class="leftClass">
        <el-row style="height: 100%">
          <el-col style="height: 100%" :span="24" class="rightview">
            <el-col
              :span="12"
              style="height: 100%; overflow-y: auto; padding-bottom: 50px"
            >
              <custom-title name="事件信息"></custom-title>
              <alarm-info
                :orderData="viewDataSource"
                :position="position"
                :monitors="monitors"
                hiddenTitle
                isDetail
                :rightLabelCol="8"
                isSingleColumn
              />
              <custom-title name="告警来源"></custom-title>
              <alarm-source
                :orderData="viewDataSource"
                :reldeviceData="reldevice"
                :positionMonitor="positionMonitor"
                hiddenTitle
                isSingleColumn
              />
            </el-col>
            <el-col :span="12">
              <div class="right">
                <medias-comp
                  :imgs="imgsList"
                  :order="viewDataSource"
                  :video="videoData"
                  :position.sync="position"
                  :positionMonitor.sync="positionMonitor"
                  :mapId="'alarmPanelMap' + alarmid"
                  :key="'alarmPanelMap' + alarmid"
                />
              </div>
            </el-col>
          </el-col>
        </el-row>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import demoImg from "@/assets/image/demoImg.png";
import { $store } from "@/utils/store";
import videoRepet from "@/components/eventManagement/videoRepet.vue";
import "@/assets/font/iconfont.css";
import CustomTitle from "@/components/eventManagement/Title.vue";
import MediasComp from "@/components/eventManagement/Medias.vue";
import AlarmInfo from "@/components/eventManagement/infos/AlarmInfo";
import AlarmSource from "@/components/eventManagement/infos/AlarmSource";
// import {$store, $v, DateFormat} from '@/common/public';

export default {
  components: {
    videoRepet,
    CustomTitle,
    AlarmInfo,
    AlarmSource,
    MediasComp,
  },
  props: {
    dataSource: {
      type: Object,
      default: () => [],
    },
    mainAlarmInfo: {
      type: Object,
      default: () => [],
    },
    alarmid: {
      type: String,
      default: "100%",
    },
    height: {
      type: String,
      default: "100%",
    },
  },
  data() {
    return {
      viewDataSource: {},
      reldevice: {}, //物联信息
      monitors: [],
      urlSource: "",
      userIdIsShow: true,
      orderId: "",
      oldOrderId: "",
      orderStatus: "",
      position: [0, 0], //经纬度
      imgsList: [demoImg], //图片
      imgsListDefault: [], //图片
      videoUrl: "", //视频url
      videoData: {},
      positionMonitor: [0, 0], //摄像头经纬度
    };
  },
  mounted() {
    this.viewDataSource = this.dataSource.order;
    this.reldevice = this.dataSource.reldevice;
    this.monitors = this.dataSource.monitors;
    this.videoData = this.dataSource.video;
    this.imgsList = this.dataSource.imgs;
    this.getUserState();
  },
  methods: {
    getUserState() {
      let user = $store.get("$loginInfo");
      this.userIdIsShow = user.source === "1" ? false : true;
    },
    warningType(val) {
      switch (val) {
        case "1":
          return "算法AI告警";
        case "2":
          return "雷达告警";
        case "3":
          return "无人机告警";
      }
    },
  },
};
</script>

<style lang="scss" scoped>
$theme: var(--theme);
.page-til {
  font-size: 15px;
  padding: 0 0 0 8px;
}
.view {
  height: 100%;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0px 10px 12px 3px rgba(213, 210, 233, 0.55);
  border-radius: 8px;
  margin-top: 10px;
}

.right {
  margin-right: 0;
  /*margin-bottom: 3vh;*/
  margin-top: 0px;
  padding-left: 12px;
}

.rightview {
  height: 100%;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0px 10px 12px 3px rgba(213, 210, 233, 0.55);
  border-radius: 8px;
  // padding: 20px 0px;
}

.icon {
  width: 8px;
  height: 8px;
  background: #00be8e;
  border-radius: 50%;
  display: inline-block;
  margin: 10px 5px 10px 8px;
}

.fontStyle {
  height: 30px;
  font-size: 16px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: #ffffff;
  line-height: 30px;
}

.infospace {
  margin-bottom: 1.5%;
  margin-top: 1.5%;
  float: left !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  width: 100%;
}

.icon {
  width: 8px;
  height: 8px;
  background: #ffffff;
  border-radius: 50%;
  margin-left: 1vh;
  margin-right: 1vh;
}
</style>
